package a.f.e;

import a.c.y;
import a.d.n;
import a.d.o;
import a.d.t;
import a.d.w;

import java.util.Arrays;
import java.util.Comparator;

class m
{
  private static final double a = 0.001D;
  private static final int c = 3;
  private static final int d = 1;
  
  private static t a(o paramo)
  {
    int j = a.B;
    int i = a.A;
    double d1;
    double d2;
    double d3;
    double d4;
    if (j == 0) {
      if (paramo.i() == 0.0D)
      {
        if (j != 0) {
          break label83;
        }
        if (paramo.j() == -1.0D)
        {
          d1 = paramo.d();
          d2 = paramo.e() - paramo.h();
          d3 = paramo.h();
          d4 = paramo.g();
          if ((j == 0) && (i == 0)) {
            break label271;
          }
        }
      }
    }
    label83:
    if (j == 0) {
      if (paramo.i() == 0.0D)
      {
        if (j != 0) {
          break label148;
        }
        if (paramo.j() == 1.0D)
        {
          d1 = paramo.d() - paramo.g();
          d2 = paramo.e();
          d3 = paramo.h();
          d4 = paramo.g();
          if ((j == 0) && (i == 0)) {
            break label271;
          }
        }
      }
    }
    label148:
    if (j == 0) {
      if (paramo.i() == 1.0D)
      {
        if (j != 0) {
          break label210;
        }
        if (paramo.j() == 0.0D)
        {
          d1 = paramo.d();
          d2 = paramo.e();
          d3 = paramo.g();
          d4 = paramo.h();
          if ((j == 0) && (i == 0)) {
            break label271;
          }
        }
      }
    }
    label210:
    if ((j != 0) || ((paramo.i() == -1.0D) && ((j != 0) || (paramo.j() == 0.0D))))
    {
      d1 = paramo.d() - paramo.g();
      d2 = paramo.e() - paramo.h();
      d3 = paramo.g();
      d4 = paramo.h();
      if (i == 0) {}
    }
    else
    {
      return null;
    }
    label271:
    return new t(d1, d2, d4, d3);
  }
  
  private static boolean c(o paramo)
  {
    int i = a.B;
    if (i == 0) {
      if (paramo.i() == 0.0D)
      {
        if (i != 0) {
          break label113;
        }
        if (paramo.j() == -1.0D) {
          break label112;
        }
      }
    }
    if (i == 0) {
      if (paramo.i() == 0.0D)
      {
        if (i != 0) {
          break label113;
        }
        if (paramo.j() == 1.0D) {
          break label112;
        }
      }
    }
    if (i == 0) {
      if (paramo.i() == -1.0D)
      {
        if (i != 0) {
          break label113;
        }
        if (paramo.j() == 0.0D) {
          break label112;
        }
      }
    }
    if ((i != 0) || (paramo.i() == 1.0D)) {
      if (i != 0) {}
    }
    label112:
    label113:
    return paramo.j() == 0.0D;
  }
  
  static double a(o paramo1, o paramo2)
  {
    int m = a.B;
    int k = a.A;
    if (m == 0) {
      if (c(paramo1))
      {
        if (m != 0) {
          break label54;
        }
        if (c(paramo2)) {
          return a(a(paramo1), a(paramo2));
        }
      }
    }
    label54:
    if ((m != 0) || (!o.a(paramo1, paramo2, 0.001D))) {
      if (m == 0)
      {
        if (!o.a(paramo2, paramo1, 0.001D)) {
          if (m != 0) {
            break label95;
          }
        }
      }
      else {
        if (!paramo2.equals(paramo1)) {
          break label93;
        }
      }
    }
    return 1.0D;
    label93:
    label95:
    w[] arrayOfw = b(paramo1, paramo2);
    if (arrayOfw != null)
    {
      double d1 = 0.0D;
      int i = 0;
      do
      {
        if (i >= arrayOfw.length) {
          break;
        }
        int j = (i + 1) % arrayOfw.length;
        if (m != 0) {
          break label201;
        }
        d1 += (arrayOfw[i].a + arrayOfw[j].a) * (arrayOfw[j].b - arrayOfw[i].b);
        i++;
        if (k != 0) {
          break label190;
        }
      } while (k == 0);
      if (m == 0) {
        d1 = Math.abs(d1 * 0.5D);
      }
      label190:
      label201:
      double d2 = d1 / (paramo1.g() * paramo1.h());
      double d3 = d1 / (paramo2.g() * paramo2.h());
      return Math.max(d2, d3);
    }
    return 0.0D;
  }
  
  static double a(o paramo, t paramt)
  {
    return a(paramo, new o(paramt));
  }
  
  private static double a(t paramt1, t paramt2)
  {
    int i = a.B;
    if (((i != 0) || (!paramt1.b(paramt2))) && ((i != 0) || (!paramt2.b(paramt1))))
    {
      if (i != 0) {
        break label56;
      }
      if (!paramt2.equals(paramt1)) {}
    }
    else
    {
      return 1.0D;
    }
    if ((i != 0) || (t.a(paramt1, paramt2)))
    {
      label56:
      t localt = b(paramt1, paramt2);
      double d1 = localt.a * localt.b;
      double d2 = d1 / (paramt1.a * paramt1.b);
      double d3 = d1 / (paramt2.a * paramt2.b);
      return Math.max(d2, d3);
    }
    return 0.0D;
  }
  
  private static t b(t paramt1, t paramt2)
  {
    double d1 = Math.max(paramt1.d, paramt2.d);
    double d2 = Math.max(paramt1.e, paramt2.e);
    double d3 = Math.min(paramt1.d + paramt1.a, paramt2.d + paramt2.a) - d1;
    double d4 = Math.min(paramt1.e + paramt1.b, paramt2.e + paramt2.b) - d2;
    return new t(d1, d2, d3, d4);
  }
  
  private static w[] b(o paramo1, o paramo2)
  {
    int n = a.B;
    int m = a.A;
    w[] arrayOfw1 = o.a(paramo1);
    w[] arrayOfw2 = o.a(paramo2);
    a.c.z localz = new a.c.z();
    int i = 0;
    label142:
    label144:
    do
    {
      if (i >= 4) {
        break;
      }
      n localn1 = new n(arrayOfw1[i], arrayOfw1[((i + 1) % 4)]);
      if (m != 0) {
        break label153;
      }
      int k = 0;
      do
      {
        if (k >= 4) {
          break;
        }
        n localn2 = new n(arrayOfw2[k], arrayOfw2[((k + 1) % 4)]);
        w localw = n.a(localn1, localn2);
        if (n != 0) {
          break label144;
        }
        if (m != 0) {
          break label142;
        }
        if (localw != null) {
          localz.add(localw);
        }
        k++;
      } while (m == 0);
      if (n == 0) {
        i++;
      }
    } while (m == 0);
    if (n == 0) {
      label153:
      i = 0;
    }
    do
    {
      if (i >= 4) {
        break;
      }
      if (m != 0) {
        break label237;
      }
      if (o.a(paramo1, arrayOfw2[i], 0.001D)) {
        localz.add(arrayOfw2[i]);
      }
      if (n == 0)
      {
        if (o.a(paramo2, arrayOfw1[i], 0.001D)) {
          localz.add(arrayOfw1[i]);
        }
        i++;
      }
    } while (m == 0);
    if (n == 0) {
      if (localz.isEmpty()) {
        label237:
        return null;
      }
    }
    w[] arrayOfw3 = new w[localz.size()];
    int j = 0;
    y localy = localz.h();
    if (localy.e()) {}
    for (;;)
    {
      if (n == 0)
      {
        arrayOfw3[(j++)] = ((w)localy.j());
        localy.f();
        if (m == 0)
        {
          if (m == 0) {
            break;
          }
          if (n != 0) {
            continue;
          }
          Arrays.sort(arrayOfw3, new b_(arrayOfw3, null));
        }
      }
    }
    return arrayOfw3;
  }
  
  static double a(o paramo, n paramn)
  {
    int j = a.B;
    int i = a.A;
    if (j == 0)
    {
      if (c(paramo)) {
        return a(a(paramo), paramn);
      }
      if (j != 0) {}
    }
    else if (!o.a(paramo, paramn, 0.001D))
    {
      return 0.0D;
    }
    w localw1 = paramo.l();
    double d1 = new n(localw1, paramo.c()).h();
    double d2 = Math.sqrt(paramo.g() * paramo.g() + paramo.h() * paramo.h());
    w[] arrayOfw = b(paramo, paramn);
    if (j == 0) {
      if (arrayOfw == null)
      {
        localn = paramn;
        if ((j == 0) && (i == 0)) {
          break label205;
        }
      }
    }
    if ((j != 0) || (arrayOfw.length == 1))
    {
      w localw2 = o.a(paramo, paramn.d(), 0.001D) ? paramn.d() : paramn.e();
      if (j != 0) {
        break label203;
      }
      localn = new n(localw2, arrayOfw[0]);
      if (i == 0) {
        break label205;
      }
    }
    label203:
    n localn = new n(arrayOfw[0], arrayOfw[1]);
    label205:
    double d3 = localn.h() / d2;
    double d4 = 1.0D - e.a(localn, localw1) / d1;
    return (3.0D * d4 + 1.0D * d3) / 4.0D;
  }
  
  private static w[] b(o paramo, n paramn)
  {
    int m = a.B;
    int k = a.A;
    w[] arrayOfw1 = o.a(paramo);
    a.c.z localz = new a.c.z();
    int i = 0;
    do
    {
      do
      {
        if (i >= arrayOfw1.length) {
          break;
        }
        n localn = new n(arrayOfw1[i], arrayOfw1[((i + 1) % arrayOfw1.length)]);
        localObject = n.a(localn, paramn);
        if (m != 0) {
          break label151;
        }
        if (k != 0) {
          break label147;
        }
        if (localObject != null)
        {
          localz.add(localObject);
          if (m != 0) {
            continue;
          }
          if (k == 0) {}
        }
        else
        {
          if (m != 0) {
            continue;
          }
          if (paramn.b(arrayOfw1[i])) {
            localz.add(arrayOfw1[i]);
          }
        }
        i++;
      } while (k == 0);
    } while (m != 0);
    if (m == 0) {
      if (localz.isEmpty()) {
        return null;
      }
    }
    label147:
    label151:
    w[] arrayOfw2 = new w[localz.size()];
    int j = 0;
    Object localObject = localz.h();
    do
    {
      while (k == 0)
      {
        if (!((y)localObject).e()) {
          break;
        }
        if ((m == 0) && (k != 0)) {
          break label222;
        }
        arrayOfw2[(j++)] = ((w)((y)localObject).j());
        ((y)localObject).f();
      }
    } while (m != 0);
    label222:
    return arrayOfw2;
  }
  
  private static double a(t paramt, n paramn)
  {
    int j = a.B;
    int i = a.A;
    if (!paramn.a(paramt)) {
      return 0.0D;
    }
    w localw1 = new w(paramt.d + paramt.a * 0.5D, paramt.e + paramt.b * 0.5D);
    double d1 = new n(localw1, paramt.f()).h();
    double d2 = Math.sqrt(paramt.a * paramt.a + paramt.b * paramt.b);
    w[] arrayOfw = c(paramt, paramn);
    if (j == 0) {
      if (arrayOfw == null)
      {
        localn = paramn;
        if ((j == 0) && (i == 0)) {
          break label202;
        }
      }
    }
    if ((j != 0) || (arrayOfw.length == 1))
    {
      w localw2 = paramt.a(paramn.d()) ? paramn.d() : paramn.e();
      if (j != 0) {
        break label200;
      }
      localn = new n(localw2, arrayOfw[0]);
      if (i == 0) {
        break label202;
      }
    }
    label200:
    n localn = new n(arrayOfw[0], arrayOfw[1]);
    label202:
    double d3 = localn.h() / d2;
    double d4 = 1.0D - e.a(localn, localw1) / d1;
    return (3.0D * d4 + 1.0D * d3) / 4.0D;
  }
  
  private static w[] c(t paramt, n paramn)
  {
    int k = a.B;
    int j = a.A;
    w localw1 = paramt.f();
    w localw2 = new w(localw1.a, localw1.b + paramt.c());
    w localw3 = new w(localw2.a + paramt.b(), localw2.b);
    w localw4 = new w(localw3.a, localw1.b);
    a.c.z localz = new a.c.z();
    n localn1 = new n(localw1, localw2);
    w localw5 = n.a(localn1, paramn);
    if (localw5 != null) {
      localz.add(localw5);
    }
    n localn2 = new n(localw4, localw3);
    if (k == 0)
    {
      localw5 = n.a(localn2, paramn);
      if (localw5 != null) {
        localz.add(localw5);
      }
    }
    n localn3 = new n(localw1, localw4);
    if (k == 0)
    {
      localw5 = n.a(localn3, paramn);
      if (localw5 != null) {
        localz.add(localw5);
      }
    }
    n localn4 = new n(localw2, localw3);
    if (k == 0)
    {
      localw5 = n.a(localn4, paramn);
      if (localw5 != null) {
        localz.add(localw5);
      }
    }
    if (k == 0) {
      if (paramn.b(localw1)) {
        localz.add(localw1);
      }
    }
    if (k == 0) {
      if (paramn.b(localw4)) {
        localz.add(localw4);
      }
    }
    if (k == 0) {
      if (paramn.b(localw2)) {
        localz.add(localw2);
      }
    }
    if (k == 0) {
      if (paramn.b(localw3)) {
        localz.add(localw3);
      }
    }
    if (k == 0) {
      if (localz.isEmpty()) {
        return null;
      }
    }
    w[] arrayOfw = new w[localz.size()];
    int i = 0;
    y localy = localz.h();
    do
    {
      while (j == 0)
      {
        if (!localy.e()) {
          break;
        }
        if ((k == 0) && (j != 0)) {
          break label408;
        }
        arrayOfw[(i++)] = ((w)localy.j());
        localy.f();
      }
    } while (k != 0);
    label408:
    return arrayOfw;
  }
  
  private static class b_
    implements Comparator
  {
    private w a;
    private static final a.d.z b = new a.d.z(0.0D, -1.0D);
    
    private b_(w[] paramArrayOfw)
    {
      double d1 = 0.0D;
      double d2 = 0.0D;
      int i = 0;
      if (i < paramArrayOfw.length)
      {
        d1 += paramArrayOfw[i].a;
        d2 += paramArrayOfw[i].b;
        i++;
      }
      for (;;)
      {
        if ((k != 0) || (j == 0))
        {
          if (j == 0) {
            break;
          }
          if (k == 0) {
            this.a = new w(d1 / paramArrayOfw.length, d2 / paramArrayOfw.length);
          }
        }
      }
    }
    
    public int compare(Object paramObject1, Object paramObject2)
    {
      int i = a.B;
      a.d.z localz1 = new a.d.z(this.a, (w)paramObject1);
      a.d.z localz2 = new a.d.z(this.a, (w)paramObject2);
      double d1 = a.d.z.d(b, localz1);
      double d2 = a.d.z.d(b, localz2);
      if (i == 0) {
        if (d1 < d2) {
          return -1;
        }
      }
      if (i == 0) {
        if (d1 > d2) {
          return 1;
        }
      }
      return 0;
    }
    
    b_(w[] paramArrayOfw, m.0 param0)
    {
      this(paramArrayOfw);
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.e.m

 * JD-Core Version:    0.7.0.1

 */